<template>
  <div class="dashboard-container">
    <h2 @click="toInfo">参数信息</h2>
    <el-table :data="tableData">
      <el-table-column prop="name" label="项目名"> </el-table-column>
      <el-table-column label="项目值">
        <template slot-scope="scope">
          <div v-html="scope.row.value"></div>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import { UserModule } from "@/store/modules/user";
import { SoftVersion } from "@/api/commonApi";
@Component({
  name: "dashboard",
})
export default class extends Vue {
  private softVer = (<any>window).HTMLVERSION;
  private softVerName = "API版本号";
  private tableData: Array<any> = [
    {
      name: "UI版本号",
      value: (<any>window).HTMLVERSION,
    },
    {
      name: this.softVerName,
      value: "",
    },
    {
      name: "API地址",
      value: (<any>window).MyConf.APISERVICE,
    },
    {
      name: "UI默认时间段",
      value: `${(<any>window).MyConf.TIMEINTERVAL}月`,
    },

    {
      name: "更新说明",
      value: `本次更新添加或更新了“DRG权重”、“V病组标杆值”、Vdcp_诊断信息、Vdcp_病人信息<br/>Vdcp_费用信息、V路径模板2路径版本、logback.xml日志配置文件`,
    },
  ];
  get name() {
    return UserModule.name;
  }

  get roles() {
    return UserModule.roles;
  }

  private async getVersion() {
    let hv: any = await SoftVersion();
    hv = hv.data;
    this.tableData
      .filter((it: any) => it.name == this.softVerName)
      .forEach((it: any) => {
        it.value = hv;
      });
  }

  private created() {
    this.getVersion();
  }
  private toInfo() {
    this.$router.push("/pathPage?uid=xxx&jzh=1675035-1");
  }
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }

  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
